home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / PhotoShop.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  8.2 KB  |  218 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        PhotoShop.vu
  5. #
  6. #    Contains:    Quick look test script for Photoshop version 2.0.1
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.6>     9/28/93    KTA        Added returnVal for ModifyDocument hook.
  19. #     <1.0.3>     7/30/93    KTA        Commented out DoText() since there are no font menus.
  20. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  21. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  22. #
  23. # ****************************************************************************
  24. #
  25.  
  26.  
  27.  
  28. ########################################################################
  29. #                            External libraries 
  30. #=======================================================================
  31. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  32.  
  33.  
  34. #########################################################################
  35. ########               Application Specific Tasks
  36. #########################################################################
  37.  
  38. #########################################################################
  39. #                        InitAppGlobals()
  40. #========================================================================
  41. # Author:        ML
  42. # Description:    Sets up tools and fonts for Photoshop.  This task
  43. #                must be called first.
  44. # Parameters:    None
  45. # Returns:        Nothing
  46. # Examples:        InitAppGlobals()
  47. #========================================================================
  48. # History:
  49. #
  50. ########################################################################
  51. task InitAppGlobals()
  52. begin
  53.     
  54.     logstr("setting up {global gApptitle}'s globals");            
  55.     global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
  56.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  57.     global kToolPaletteNum := 1; 
  58.     global kLinePaletteNum := 0;
  59.     global kPatternPaletteNum := 0;
  60.     global kColorPaletteNum := 2;
  61.  
  62.     global gLineWeights := {};# This is used for menuItems
  63.                         
  64.     global gWindowInset := {0,20,20,20};        # Window inset
  65.     global gScreenInset := {62,20,0,0};            # Screen inset
  66.     global gVoidRect := {};        # Rect not to draw in - coordinates should be RelativeToWindow
  67.     global gTextStr;
  68.     global gDocumentWindow := 0;    # only used in Freehand at this point;
  69.     
  70.     global gPaletteList :=    {
  71.                             {                        #### Start Palette #1 - Tools
  72.                             {5, 36, 55, 256},        # Location of palette absolute Coordinates
  73.                             kPalDocWind,            # Palette type
  74.                             {2,10},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  75.                             {25,22}                    # Offset between tools {h,v}
  76.                             }                        #### End Palette #1
  77.     };
  78.     
  79.     
  80.     ### PhotoShop                                                                    {Flag, Pattern, Line, Color}
  81.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  82.     global SelectionTool     :=     { 1,     1,        "Selection",    kDrag,         0,                 {0}};
  83.     global RndSelectionTool :=     { 2,     1,        "RndSelection", kDrag,        0,                 {0}};
  84.     global LassoTool        :=     { 3,     1,        "Lasso",        kMultiDrag, 0,                 {0}};
  85.     global WandTool            :=     { 4,      1,        "Wand",            kClick,        0,                 {0}};
  86.  
  87.     global CropTool             :=     { 5,     1,        "Crop",            kDrag,        1,                 {0}};
  88.     global PenTool             :=     { 6,      1,        "Pen",            kMultiClick,0,                 {0}};
  89.     global HandTool             :=     { 7,      1,        "Hand",            kMultiDrag,    0,                 {0}};
  90.     global ZoomTool         :=     { 8,      1,        "Zoom",            kClick,     0,                 {0}};
  91.  
  92.     global BucketTool         :=     { 9,     1,         "Bucket",        kClick,        0,                 {0}};
  93.     global BlendTool        :=     { 10,     1,        "Blend",        kDrag,         0,                 {0}};
  94.     global LineTool            :=     { 11,     1,        "Line",            kDrag,        0,                 {0}};
  95.     global ColorDropper        :=     { 12,     1,        "ColorDropper",    kMultiClick,0,                 {0}};
  96.  
  97.     global EraserTool        :=     { 13,     1,         "Eraser",        kMultiDrag,    0,                 {0}};
  98.     global PencilTool         :=     { 14,     1,         "Pencil",        kMultiDrag,    0,                 {0}};
  99.     global AirBrush             :=     { 15,     1,         "AirBrush",        kMultiDrag,    0,                 {0}};
  100.     global PaintBrush         :=     { 16,     1,         "PaintBrush",    kMultiDrag,    0,                 {0}};
  101.  
  102.     global RubberStamp        :=     { 17,     1,         "RubberStamp",    kDragClick,    0,                 {0}};
  103.     global SmudgeTool         :=     { 18,     1,         "Smudge",        kDrag,        0,                 {0}};
  104.     global BlurTool             :=     { 19,     1,         "Blur",            kDrag,        0,                 {0}};
  105.     global CharTool             :=     { 20,     1,         "Character",    kClick,        0,                 {0}};
  106.  
  107.  
  108.     # global Tool list
  109.     global gToolList:={    SelectionTool, 
  110.                         RndSelectionTool,
  111.                         LassoTool,
  112.                         #WandTool,
  113.                         
  114.                         #CropTool,
  115.                         #PenTool,
  116.                         HandTool,
  117.                         ZoomTool,
  118.                         
  119.                         BucketTool,
  120.                         BlendTool,
  121.                         LineTool,
  122.                         ColorDropper,
  123.                         
  124.                         EraserTool,
  125.                         PencilTool,
  126.                         AirBrush,
  127.                         PaintBrush,
  128.                         
  129.                         RubberStamp,
  130.                         SmudgeTool,
  131.                         BlurTool
  132.                         #CharTool                    
  133.     };
  134.     
  135.         ### Set DoWindows to skip scrolling, scroll bars not recongnized
  136.     global gDoWindowList:= {1,0,1,1};
  137.  
  138. end; # InitAppGlobals
  139.  
  140. #########################################################################
  141. #                            PhotoShopModifyDocument()
  142. #========================================================================
  143. # Author:        ML
  144. # Description:    Modify PhotoShop Document
  145. # Parameters:    None
  146. # Returns:        Nothing
  147. # Examples:        PhotoShopModifyDocument();
  148. # Assumptions:    None 
  149. # Applications:    PhotoShop
  150. #========================================================================
  151. # History:
  152. #
  153. #########################################################################
  154. task PhotoShopModifyDocument()
  155. begin
  156.     return(Scrapbook(global kScrapPict));
  157. end;
  158.  
  159. #########################################################################
  160. #                            PhotoShopScrapText()
  161. #========================================================================
  162. # Author:        ML
  163. # Description:    Paste text into PhotoShop Document
  164. # Parameters:    None
  165. # Returns:        Nothing
  166. # Examples:        PhotoShopScrapText();
  167. # Assumptions:    None 
  168. # Applications:    PhotoShop
  169. #========================================================================
  170. # History:
  171. #
  172. #########################################################################
  173. task PhotoShopScrapText()
  174. begin
  175.     Scrapbook(global kScrapTEXT,,0);
  176.     Draw(global CharTool);
  177.     KeyEq("v");    #    Can't use SelectmenuItem because VU thinks it's disabled
  178.     SpecialKey(EnterKey, "EnterKey");
  179.     wait(1);
  180.     if     (DialogCheck('',1))
  181.         SpecialKey(EnterKey, "EnterKey");
  182. end;
  183.  
  184. ################################################################################
  185. ####################             Main script                    ####################
  186. ################################################################################
  187. script PhotoShop (ScriptLevel:= -1)
  188. begin
  189.     InitGlobals(ScriptLevel);            # initialize your general globals
  190.     InitDraw();
  191.     InitFonts();
  192.     Global gApptitle := "Adobe PhotoShop";     # Title of app you will be running
  193.     global gAppVersion := '2';        # version of app you will be running
  194.     SuiteStart('PhotoShop.vu');                    # begin a new test suite
  195.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  196.     begin
  197.         global gFileName := "@!@-{gBuildVers}-PhotoShop";    # This is used in NameOK when saving files
  198.         global gModifyDocument:= task PhotoShopModifyDocument; # define app specific task
  199.         global gCustomScrapText:= task PhotoShopScrapText;     # define app specific task    
  200.         InitAppGlobals();                                    # init app specific globals
  201.         (*
  202.         *)
  203.         DoSetUpApp(,,,"OK",1,1,1);    # No Default window
  204.         #DoText(0);                    # No Font Menus in Photoshop #commented out KA - 7/30/93
  205.         DoWindow();                    # There are no recognizable scrollbars in Photoshop
  206.         DoCloseApp(1);            
  207.         LogStr("############################# LIMITATIONS: ############################");
  208.         LogStr("NOTE: Fonts and Styles are contained within dialog boxes, so no DoText");
  209.         LogStr("NOTE: VU does not recognizable scrollbars, so scrolling not tested.");
  210.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  211.     SuiteEnd();
  212. end;    # script PhotoShop
  213.  
  214. ### What's Needed
  215. # 1) Insure that Palette is up and in the left corner or the screen
  216. # 2) Insure that Drawing window does not cover any portion of the palette
  217. # 3) Insure that Pointer tool is selected after DoText before DoWindow 
  218.